<?php declare(strict_types=1);
namespace App\Http\Controller\Test;

use Swoft\Http\Message\Request;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;
use Swoft\Http\Server\Annotation\Mapping\RequestMethod;

/**
 * Class UserController
 *
 * @Controller(prefix="User")
 * @package App\Http\Controller\Test
 */
class UserController extends BaseController
{
    /**
     * 获取用户列表
     * @RequestMapping("user_list",method={RequestMethod::GET})
     */
    public function userList(){
        return $this->service2User->getList(1234,'list');
    }

    /**
     * 获取用户信息
     * @RequestMapping("userinfo",method={RequestMethod::GET})
     */
    public function userinfo(Request $request)
    {
        $userInfo = $request->input('userInfo');
        return $this->serviceUser->getUser((int)$userInfo['user_id']);
    }

    /**
     * 获取用户详细信息
     * @RequestMapping("user_detail",method={RequestMethod::GET})
     */
    public function userDetail(Request $request)
    {
        $userInfo = $request->input('userInfo');
        return $this->serviceUser->getUserDetail($userInfo['user_id']);
    }
}